
cc.Class({
    extends: cc.Component,
    properties: {
        ui_content: cc.Label,
        ui_nodesure: cc.Node,
        ui_nodeclose: cc.Node,

        _onComplete : null,
        _onIOError : null,
    },

    init(content,successCallBack=null,cancelCallBack=null) {
        this._onComplete = successCallBack;
        this._onIOError = cancelCallBack;

        this.ui_content.string = content;
        if (successCallBack){
            this.ui_nodesure.active = false;
            this.ui_nodeclose.active = true;
        }else{
            this.ui_nodesure.active = true;
        }
    },
    onclick(event,customEventData){
        Global.AudioManager.playSound();
        if (customEventData == 'sure'){
            this._onComplete && this._onComplete()
        }else{
            this._onIOError && this._onIOError()
        }
        this.node.removeFromParent();
    }

});
